xend: Extra qemu options: parallel,serial,monitor
authorKeir Fraser <keir.fraser@citrix.com>
Wed, 23 Dec 2009 07:36:33 +0000 (07:36 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Wed, 23 Dec 2009 07:36:33 +0000 (07:36 +0000)
Allows par/ser ports to be configured with a path to backing device.
Allows qemu monitor to be disabled or redirected.

Signed-off-by: Daniel Kiper <dkiper@net-space.pl>
tools/python/xen/xend/XendConfig.py
tools/python/xen/xend/image.py
tools/python/xen/xm/create.py

index 150aacdcaf8146d6f029b6d7cdd721766ba7cdad..dfcb984e113629af3d97c71893388ac00224e53c 100644 (file)
@@ -145,11 +145,12 @@ XENAPI_PLATFORM_CFG_TYPES = {
     'keymap': str,
     'isa' : int,
     'localtime': int,
-    'monitor': int,
+    'monitor': str,
     'nographic': int,
     'nomigrate': int,
     'pae' : int,
     'rtc_timeoffset': int,
+    'parallel': str,
     'serial': str,
     'sdl': int,
     'opengl': int,
index 00f5b86d1fe6685ba4fbf8fbbf63f4f130c5f8fc..c13e93ad2e077d1222bde4be06eddfe6bfc8cb0b 100644 (file)
@@ -368,8 +368,17 @@ class ImageHandler:
         if not has_sdl and not has_vnc :
             ret.append('-nographic')
 
-        if int(vmConfig['platform'].get('monitor', 0)) != 0:
-            ret = ret + ['-monitor', 'vc']
+        if vmConfig['platform'].get('parallel'):
+            ret = ret + ["-parallel", vmConfig['platform'].get('parallel')]
+
+        if type(vmConfig['platform'].get('monitor', 0)) is int:
+            if int(vmConfig['platform'].get('monitor', 0)) != 0:
+                ret = ret + ['-monitor', 'vc']
+            else:
+                ret = ret + ['-monitor', 'null']
+        else:
+            ret = ret + ['-monitor', vmConfig['platform'].get('monitor', 0)]
+
         return ret
 
     def getDeviceModelArgs(self, restore = False):
@@ -756,9 +765,10 @@ class LinuxImageHandler(ImageHandler):
 
     def parseDeviceModelArgs(self, vmConfig):
         ret = ImageHandler.parseDeviceModelArgs(self, vmConfig)
-        # Equivalent to old xenconsoled behaviour. Should make
-        # it configurable in future
-        ret = ["-serial", "pty"] + ret
+        if vmConfig['platform'].get('serial'):
+            ret = ["-serial", vmConfig['platform'].get('serial')] + ret
+        else:
+            ret = ["-serial", "pty"] + ret
         return ret
 
     def getDeviceModelArgs(self, restore = False):
index fcd2f211f5d6fda8299ee2d655d7d91c121b550b..d89a23e3a17aa2c8020e0f0048c1e9868d5efc2b 100644 (file)
@@ -503,12 +503,16 @@ gopts.var('fdb', val='FILE',
           fn=set_value, default='',
           use="Path to fdb")
 
+gopts.var('parallel', val='FILE',
+          fn=set_value, default='',
+          use="Path to parallel or pty or vc")
+
 gopts.var('serial', val='FILE',
           fn=set_value, default='',
           use="Path to serial or pty or vc")
 
-gopts.var('monitor', val='no|yes',
-          fn=set_bool, default=0,
+gopts.var('monitor', val='0|1|FILE',
+          fn=set_value, default=1,
           use="""Should the device model use monitor?""")
 
 gopts.var('localtime', val='no|yes',
@@ -737,6 +741,12 @@ def configure_image(vals):
         config_image.append(['root', cmdline_root])
     if vals.videoram:
         config_image.append(['videoram', vals.videoram])
+    if vals.parallel:
+        config_image.append(['parallel', vals.parallel])
+    if vals.serial:
+        config_image.append(['serial', vals.serial])
+    if vals.monitor:
+        config_image.append(['monitor', vals.monitor])
     if vals.extra:
         config_image.append(['args', vals.extra])
     if vals.superpages:
@@ -1052,12 +1062,11 @@ def configure_hvm(config_image, vals):
              'isa',
              'keymap',
              'localtime',
-             'monitor',
              'nographic',
              'opengl', 'oos',
              'pae', 'pci', 'pci_msitranslate', 'pci_power_mgmt',
              'rtc_timeoffset',
-             'sdl', 'serial', 'soundhw', 'stdvga',
+             'sdl', 'soundhw', 'stdvga',
              'timer_mode',
              'usb', 'usbdevice',
              'vcpus', 'vnc', 'vncconsole', 'vncdisplay', 'vnclisten',